/*
    XTU OJ: 1382
    by: fifth_light
*/

#include <stdio.h>

#define x2id(x, y, n) (((n) + (n) + 1) * (x) + (y))
#define y2id(x, y, n) (((n) + (n) + 1) * (x) + (n) + (y))

int count(char sticks[5100], int n) {
    int cnt = 0;
    for(int w = 1; w <= n; w++){
        for(int x = 0; x <= n - w; x++)
            for(int y = 0; y <= n - w; y++){
                for(int i = 0; i < w; i++){
                    if(sticks[x2id(x, y + i, n)]) goto next;
                    if(sticks[x2id(x + w, y + i, n)]) goto next;
                    if(sticks[y2id(x + i, y, n)]) goto next;
                    if(sticks[y2id(x + i, y + w, n)]) goto next;
                }
                cnt++;
                next:;
            }
        }
    return cnt;
}

int main(void) {
    int t;
    scanf("%d", &t);
    for(int i = 0; i < t; i++) {
        char sticks[5100] = {0};
        int n, m;
        scanf("%d%d", &n, &m);
        for (int i = 0; i < m; i++) {
            int id;
            scanf("%d", &id);
            sticks[id - 1] = 1;
        }
        printf("%d\n", count(sticks, n));
    }
    return 0;
}
